package cn.lu.train.util;


public class DataUtils {

    public static int position = -1;
    private static Object data;

    public static void setData(Object data) {
        DataUtils.data = data;
    }

    public static int getPosition() {
        if (position > -1) {
            int i = position;
            position = -1;
            return i;
        }
        return position;
    }

    @SuppressWarnings("unchecked")
    public static  <T> T getData() {
        return (T) data;
    }

    public static void clear() {
        data = null;
    }
}
